<template>
	<view>
		<view>
			
		</view>
	</view>
</template>

<script>
	var Api = require("../../utils/api.js");
	var util = require("../../utils/util.js");
	var wxApi = require("../../utils/wxApi.js");
	var wxRequest = require("../../utils/wxRequest.js");
	export default {
		data() {
			return {
				keycode:'',
				uid:'',
				tid:'',
				quan:'',
				huid:'',
				quanuid:'',
				tieuid:''
			}
		},
		onLoad(options,event) {
			var duixin = this;
			
			duixin.getDangqianurl();//获取当前网址
			duixin.tid = options.tid;
			    console.log('tid',duixin.tid);
			duixin.quan = options.quan;
			    console.log('quan',duixin.quan);
			duixin.huid = options.uid;
			    console.log('huid',duixin.huid);
			duixin.quanuid = options.quanuid;
			    console.log('quanuid',duixin.quanuid);
			duixin.tieuid = options.tieuid;
			    console.log('tieuid',duixin.tieuid);
			//duixin.getErweima();
			uni.setNavigationBarTitle({
			title: '活动二维码认证'
			});
			var keycode = uni.getStorageSync('keycode');
			duixin.keycode = keycode;
			var uid = uni.getStorageSync('memberuid');
			duixin.uid = uid;
			if(keycode){
				duixin.getHuodongrenzhengData();
			} else {
				uni.redirectTo({
					url: '/pages/login/login'
				});
			}
			
		},
		methods: {
			//获取当前页面
			getDangqianurl() {
				//获取当前页面栈的实例
				let pages = getCurrentPages();
				//获取当前页面
				let currentPage = pages[pages.length-1].$page.fullPath;
				let url = currentPage;
				uni.setStorageSync('dangqianUrl', url);
			},
			//活动认证接口
			getHuodongrenzhengData(){
				var duixin = this;
				/*console.log('tid2',duixin.tid);
				
				    console.log('quan2',duixin.quan);
				
				    console.log('huid2',duixin.huid);
				
				    console.log('duixinkeycode',duixin.keycode);
				
				    console.log('duixinuid',duixin.uid);*/
				var dataurl = '&tid='+duixin.tid+'&quan='+duixin.quan+'&uid='+duixin.huid+'&quanuid='+duixin.quanuid+'&tieuid='+duixin.tieuid;
				var getHuodongrenzhengRequest = wxRequest.getRequest(Api.getHuodongrenzheng(duixin.uid,duixin.keycode)+dataurl);
				
				getHuodongrenzhengRequest.then(response => {
					console.log('response',response.data);
					if (response.data.code == 1) {
					  // 
					  //var renzhengData = response.data.data;
					  //duixin.renzheng = renzhengData
					  uni.showModal({
					  	title: '认证成功',
					  	//content: '没有名单，或名单审核中...',
					  	confirmText: '返回',
					  	success: function(res) {
					  		if (res.confirm) {
					  			uni.reLaunch({
					  				url: '/pages/index/index'
					  			});
					  		}
					  	}
					  });
					} else {
					  uni.showModal({
					  	title: '认证失败',
					  	content: response.data.msg,
					  	confirmText: '返回',
					  	success: function(res) {
					  		if (res.confirm) {
					  			uni.reLaunch({
					  				url: '/pages/index/index'
					  			});
					  		}
					  	}
					  });
					}
				});
			}
		}
	}
</script>

<style>
</style>